package com.edu.oss.controller;

import com.edu.common.utils.R;
import com.edu.oss.service.FileService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;


@RestController
@CrossOrigin
@RequestMapping("/eduoss/fileoss")
@Api(description = "文件上传")
public class OssController {
    @Autowired
    private FileService fileService;

    @ApiOperation(value = "文件上传")
    @PostMapping("/upload")
    public R uploadOssFile(@RequestParam("file") MultipartFile file){

            String url = fileService.upload(file);

        return R.ok().data("url",url).message("文件上传成功!");

    }

}
